home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / misc_src / tgraf011 / tgraf.h < prev    next >
C/C++ Source or Header  |  1995-11-01  |  4KB  |  117 lines

  1. /****************************************************************************************
  2. TGraf : A simple plotting class for line and scatter plots for VC++, BC++.
  3.       ------
  4.  
  5.     Author    : David I. Hong
  6.     e-mail    : hong@ece.ucdavis.edu
  7.  
  8.     usenet
  9.     groups    : comp.std.c++, comp.lang.c++, comp.os.linux, comp.os.ms_windows
  10.  
  11.     Date    : Feburary 5, 1995
  12.     Version    : Alpha 0.1.1
  13.  
  14.     Terms    : No registeration fee required. I mean it's FREE.
  15.           Giving a credit would be nice, though.
  16.           If it is found to be useful, please drop me a line.
  17.  
  18.     comments:
  19.         --------
  20.     . Upgraded from Alpha 0.1.0 which was released on January 12, 1995.
  21.     . Now it is in DLL instead of static lib.
  22.     . TPW is no longer supported. (I mean there is no TPW Unit for DLL)
  23.     . User can set back ground color.
  24.     . Text can be attached to each data point.
  25.     . Line_Dot plot has been added.
  26.     . Number of plot types : 4.     (pt_XXXX)
  27.     . Number of colors : 16.       (pc_XXXX)
  28.     . Number of line types : 4.    (PS_XXXX) from windows
  29.     . Number of dot types : 2.    (dt_XXXX)
  30.     . Each dot can be different dot types and color.
  31.     . Uses Win3.1 COMMDLG.DLL.
  32.  
  33.     Work in progress:
  34.     ----------------
  35.     . Increase number of dot types.
  36.     . Support for VBX.
  37.     . Support for Polar plot.
  38.     . Support for Log-Log and ln-ln plot.
  39.     . Support for Area Plot.
  40.     . Simple Curve fitting ( power series.)
  41.     . DFFT for spectrum analysis.
  42. ****************************************************************************************/
  43. #ifndef __TGRAF_H
  44. #define __TGRAF_H
  45.  
  46. //Define plot types, dot types, dot styles, line styles and colors
  47. //define pc, pen colors
  48. #define pc_blue            RGB(0,0,255)    /* blue */
  49. #define pc_green        RGB(0,255,0)    /* green */
  50. #define pc_red            RGB(255,0,0)    /* red */
  51. #define pc_magenta        RGB(255,0,255)  /* magenta */
  52. #define pc_dark_blue        RGB(0,0,128)    /* dark blue */
  53. #define pc_dark_red        RGB(128,0,0)    /* dark red */
  54. #define pc_dark_cyan        RGB(0,128,128)    /* dark cyan */
  55. #define pc_black         RGB(0,0,0)    /* black */
  56. #define pc_grey         RGB(128,128,128) /* grey */
  57. #define pc_very_dark_cyan    RGB(0,128,64)    /* very dark cyan */
  58. #define pc_dark_yellow        RGB(128,128,0)  /* dark yellow */
  59. #define pc_dark_magenta        RGB(128,0,128)    /* dark magenta */
  60. #define pc_light_grey        RGB(192,192,192) /* light grey */
  61. #define pc_cyan         RGB(0,255,255)    /* cyan */
  62. #define pc_yellow        RGB(255,255,0)    /* yellow */
  63. #define pc_white        RGB(255,255,255)/* white */
  64.  
  65. //define pt, plot types
  66. #define pt_text        0x0000
  67. #define pt_line        0x0001
  68. #define pt_line_dot    0x0002
  69. #define pt_point    0x0003
  70. #define    pt_scatter    0x0004
  71.  
  72. //define ds, dot styles
  73. #define ds_circle    0x0001
  74. #define ds_square    0x0002
  75.  
  76. //define dt, dot types
  77. #define dt_solid    0x0001
  78.  
  79.  
  80. class _export TGraf
  81. {                            // TGraf Class
  82. public:
  83.     TGraf(HWND, int, int, int, int);        //Set parent HWindow, and location
  84.     TGraf(HWND);                                    //hwindow, left, top, right, bottom
  85.     virtual ~TGraf();
  86.     LPSTR GetClassName();
  87.     void FAR New_Plot();                //Erases current plot
  88.     void FAR New_Set();                //Creates a new set to hold data points
  89.     void FAR Set_Plot_Type(int);            //Plot type
  90.     void FAR Set_Line_Style(int);            //Line style
  91.     void FAR Set_Dot_Style(int);            //Dot style
  92.     void FAR Set_Color(COLORREF);            //Color
  93.     void FAR Set_Back_Ground_Color(COLORREF);    //Back Ground Color
  94.     void FAR Set_Scale(double,double,double,double);//Xmin, ymin, xmax, ymax in user coordinate
  95.     void FAR Set_Tics(int , int, int, int);        //no. of x_major,y_major,x_minor,y_minor
  96.     void FAR Set_Titles(char*, char*, char*);       //Titles (main, x, y)
  97.     void FAR Set_X_Label_Format(char*);        //x label format : ex. "10.2f"
  98.     void FAR Set_Y_Label_Format(char*);        //y label format : ex. "10.2f"
  99.     void FAR Add_Point(double, double);        //add data point (x,y)
  100.     void FAR Add_Point(double, double, char*);    //attach text to the data point(x,y,text)
  101.     void FAR Show_Tics();                //show tics
  102.     void FAR Hide_Tics();                //hide tics
  103.     void FAR Show_Axis();                //show axis
  104.     void FAR Hide_Axis();                //hide axis
  105.     void FAR Show_Grid();                //show grid
  106.     void FAR Hide_Grid();                //hide grid
  107.     void FAR Show_Data_Text();            //show texts attached to a data point
  108.     void FAR Hide_Data_Text();            //hide texts attached to a data point
  109.     void FAR Plot(RECT);                            //plot in new region RECT
  110.     void FAR Plot();                //plot in current region
  111.     void FAR Print();                //hardcopy
  112.     void FAR About();                //Hey! About me
  113. private:
  114.     void FAR *GRAF;                    //Plotting Engine
  115. };
  116.  
  117. #endif